package org.dfzt.init;

import cn.hutool.core.util.IdUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.dfzt.common.util.RedisUtil;
import org.dfzt.modules.quartz.service.IQuartzJobService;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;

/**
 * 定时任务启动类
 * */
@Component
public class JobInitializer {
    private static final Log log = LogFactory.getLog(org.dfzt.init.JobInitializer.class);
    @Resource
    private IQuartzJobService quartzJobService;
    @Resource
    private RedisUtil redisUtil;

    @PostConstruct
    public void updateJobStatus(){
        log.info("项目重启，启动上次正在运行的定时任务");
        quartzJobService.startJob();
        /*//清空redis，慎用，请确保redis服务无人使用
        log.info("---清空redis---");
        redisUtil.deleteAll();*/
    }
}
